           package com.java.diagnostics.visualizer.displayer.plot;
           
           import com.java.diagnostics.visualizer.properties.OutputProperties;
           
           public class ZoomingYPositionConverter extends YPositionConverter
           {
             private OutputProperties properties;
             private double topPadding = 0.0D;
           
             public ZoomingYPositionConverter(boolean padPlots, boolean forceZero, OutputProperties properties)
             {
               super(padPlots, forceZero);
               this.properties = properties;
             }
           
             protected void calculateDeltas() {
               double yZoomStart = this.properties.getYZoomStart();
               double yZoomEnd = this.properties.getYZoomEnd();
           
               double range = this.max - this.min;
               this.delta = range;
           
               if (this.padPlots) {
                 double y = this.min;
           
                 this.topPadding = (this.delta * 0.1D);
                 if ((y > 0.0D) && (this.delta != 0.0D) && (y / this.delta < 0.1D))
                   this.yPadding = y;
                 else if (this.delta == 0.0D)
                   this.yPadding = this.topPadding;
               }
               else
               {
                 this.yPadding = 0.0D;
                 this.topPadding = 0.0D;
               }
           
               this.delta = (this.delta + this.yPadding + this.topPadding);
               this.lowerLimit = (this.min + this.delta * yZoomStart);
           
               this.delta *= (yZoomEnd - yZoomStart);
             }
           
             public double getAsZoomFraction(int position) {
               double yZoomStart = this.properties.getYZoomStart();
               double yZoomEnd = this.properties.getYZoomEnd();
               double currentZoomWidth = yZoomEnd - yZoomStart;
           
               position -= this.plotBottom - this.plotHeight;
               position = this.plotHeight - position;
               double newYZoomFraction = position / this.plotHeight;
           
               newYZoomFraction = yZoomStart + newYZoomFraction * currentZoomWidth;
           
               return newYZoomFraction;
             }
           }

